package com.data.modules.message.job;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.data.common.util.DateUtils;
import com.data.common.util.HttpClientUtil;
import com.data.modules.gd.entity.GdLiveChannel;
import com.data.modules.gd.service.IGdLiveChannelService;
import com.data.modules.message.service.ISysMessageService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 调用广电渠道信息
 */
@SuppressWarnings("ALL")
@Slf4j
public class SaveGdChannelJob implements Job {

	@Autowired
	private IGdLiveChannelService channelService;
	/**
	 * 若参数变量名修改 QuartzJobController中也需对应修改
	 */
	private String parameter;

	public void setParameter(String parameter) {
		this.parameter = parameter;
	}

	@Override
	public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

		long start = System.currentTimeMillis();
		log.info("SaveGdChannelJob===开始{}",start);
		try {
			channelService.synChannelInfo(this.parameter);
		} catch (Exception e) {
			log.error("SaveGdChannelJob==定时任务异常",e.getMessage(),e);
		}
		log.info("SaveGdChannelJob===结束耗时{}秒",(System.currentTimeMillis()-start)/1000);

	}

}
